﻿@inject GMS.NET.Web.Components.Service.Interface.System.IToolsService ToolsService

<Card Color="Color.Primary" IsCenter="true" IsShadow="true">
    <HeaderTemplate>
        <span class="fas fa-fw fa-seedling"></span> 系统数据种子创建
    </HeaderTemplate>
    <BodyTemplate>
        <FloatingLabel DisplayText="输入实体类命名空间" TValue="string" type="text" @bind-Value="EntityNameSpace" />
        <FloatingLabel DisplayText="输入种子数据类命名空间" TValue="string" type="text" @bind-Value="DataSeedEntityNameSpace" />
        <Button Text="创建种子数据" IsBlock="true" IsAsync="true" Icon="fas  fa-fw fa-seedling" OnClick="@DataSeed" />
    </BodyTemplate>
</Card>

@code{
    private string EntityNameSpace = "GMS.NET.Core.Entitys.System";
    private string DataSeedEntityNameSpace = "GMS.NET.SqlSugarCore.DbSeed.SeedDatas";

    private async Task DataSeed()
    {
        var descr = new GMS.NET.Dto.System.Tools.Input.DataSeedDescr() { EntityNameSpace = EntityNameSpace, DataSeedEntityNameSpace = DataSeedEntityNameSpace };
        await ToolsService.CreateDataBaseToDataSeedEntitys(descr);
    }
}